<link href="/css/shuaijin.css" rel="stylesheet">
<script src="/js/jquery.min.js"></script>

<div class="car">
<?php
	$key=("key");
	$curl = curl_init();

	 curl_setopt_array($curl, array(
	  CURLOPT_URL => "http://apis.haoservice.com/lifeservice/car/GetSeries?key=".$key,
	  CURLOPT_RETURNTRANSFER => true,
	  CURLOPT_ENCODING => "",
	  CURLOPT_MAXREDIRS => 10,
	  CURLOPT_TIMEOUT => 30,
	  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
	  CURLOPT_CUSTOMREQUEST => "GET",
	));

	$response = curl_exec($curl);
	$err = curl_error($curl);

	curl_close($curl);


	if ($err) {
	  echo "cURL Error #:" . $err;
	  exit;
	} else { //获取到了数据
	  $obj = json_decode($response,true);
	 foreach ($obj['result'] as $key => $value) {
	  	echo "<div class='car'>";
	  	echo "<!--车系列ID:". $value['I'].' &nbsp;-->'; 
	  	echo "<!--车型 :--><b>". $value['N'].'</b> &nbsp;';
	  	echo "<!--首字母 ：".$value['L'].'-->';
	  	foreach($value['List'] as $k => $value2){
	  		echo "<div class='car_body'>";
	  		echo "<!--车型分类ID :".$value2['I'].' &nbsp;-->';
	  		echo "<!--车型分类名称：--><b>". $value2['N'].'</b> &nbsp;';
	  		foreach($value2['List'] as $n=>$value3){
	  			echo "<div class='car_a'>";
	  			echo "<!--车型ID: ".$value3['I'].' &nbsp;-->';
	  			echo "<!--车型名称：--><a href='/car_url.php?pid=". $value3['I']."'> ". $value3['N'].' </a>&nbsp;';
	  			echo "</div>";
	  		}

	  		echo "</div>";
	  	}
	  	echo "<br>";
	  	echo "</div>";
	  }


    }


?>
</div>


<script>
 $(document).ready(function(){ 
 	//$(".car_a").hide();
 
        var span=$(".car_body").find(".car_show"); 
        var ul=$(".car_body").find(".car_a"); 
        span.bind("click",function(){ 
          ul.each(function(){ 
            $(this).css("display","none"); 
          }); 
          //$(this).next().css("display","block","position","relative","top","0px"); 
          $(this).next().toggle(); 
        }); 
      }); 


/*
$(document).ready(function(){
	$(".car_a").hide();
	$(".car_show").click(function(){
		//alert("11");
	 $(".car_body .car_a").toggle();
	});
});*/
</script>










